//
//  CEPointMineCell.m
//  digitalCurrency
//
//  Created by 默认账户 on 2019/4/3.
//  Copyright © 2019 XinHuoKeJi. All rights reserved.
//

#import "CEPointMineCell.h"

@implementation CEPointMineCell

+ (instancetype)createTableView:(UITableView *)tableView {
    CEPointMineCell *cell = [tableView dequeueReusableCellWithIdentifier:@"setcell"];
    cell.selectionStyle   = UITableViewCellSelectionStyleNone;
    cell.backgroundColor  = [UIColor colorWithHEX:@"22273b"];

    [cell makeViews];
    
    return cell;
}

- (void)makeViews {
    CGFloat viewwidth = SCREEN_WIDTH-30;
    
    if (self.firstTitleL) {
        return;
    }
    for (int i = 0; i < 10; i++) {
        UILabel *label  = [[UILabel alloc] init];
        label.textColor = [UIColor whiteColor];
        label.font      = [UIFont systemFontOfSize:11];
        [self addSubview:label];
        switch (i) {
            case 0:
                label.font = [UIFont systemFontOfSize:15];
                self.firstTitleL = label;
                break;
            case 1:
                label.textAlignment = NSTextAlignmentRight;
                label.font = [UIFont systemFontOfSize:15];
                self.firstContentL = label;
                break;
            case 2:
                label.text = LocalizationKey(@"激活时间:");
                break;
            case 3:
                label.textAlignment = NSTextAlignmentRight;
                self.secondContentL = label;
                break;
            case 4:
                label.text = @"截止时间:";
                break;
            case 5:
                label.textAlignment = NSTextAlignmentRight;
                self.thirdContentL = label;
                break;
            case 6:
                label.text = @"昨日收益:";
                break;
            case 7:
                label.textAlignment = NSTextAlignmentRight;
                self.forthContentL = label;
                break;
            case 8:
                label.text = @"累计收益:";
                break;
            case 9:
                label.textAlignment = NSTextAlignmentRight;
                self.fifthContentL = label;
                break;
            default:
                break;
        }

        if (i == 0 || i == 1) {
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.mas_equalTo(15 + i/2.0*5);
                make.left.mas_equalTo(15 + i%2*(viewwidth/2.0));
                make.height.mas_equalTo(15);
                make.width.mas_equalTo(viewwidth/2.0);
            }];
        }
        else {
            [label mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.mas_equalTo(50 + i/2.0*16);
                make.left.mas_equalTo(15 + i%2*(viewwidth/2.0));
                make.height.mas_equalTo(11);
                make.width.mas_equalTo(viewwidth/2.0);
            }];
        }
    }
}

- (void)setContents:(NSArray *)contents {
    NSLog(@"contents:%@",contents);
    self.firstTitleL.text    = @"";
    self.firstTitleL.text    = contents[0];
    
    self.firstContentL.text  = contents[1];
    self.secondContentL.text = contents[2];
    self.thirdContentL.text  = contents[3];
    self.forthContentL.text  = contents[4];
    self.fifthContentL.text  = contents[5];
}


@end
